/// <reference path="jquery.js" />
/// <reference path="../lang/1.js" />
/// <reference path="Verification.js" />

$(document).ready(function () {
    /* 菜单功能 */
   // jQuery("#nav").slide({ type: "menu", titCell: ".nLi", targetCell: ".sub", effect: "slideDown", delayTime: 300, triggerTime: 0, returnDefault: true });
})

function Commnet() {
	
	var Item_User=$("#Item_User").val();
	var Item_Tel=$("#Item_Tel").val();
	var Item_Content=$("#Item_Content").val();
	var Item_Time = $("#Item_Time").val();
	var VerificationImgCode = $("#VerificationImgCode").val();
	var Lang = GetVal("lang", 1);

    /* 信息完整性验证 */
	if (!ValidateLength("Item_User", 2, 40))
	    return false;
	if (!ValidateReg("Item_Tel",ValidatePhone))
	return false;
	if (!ValidateLength("Item_Content", 10,500))
	    return false;
	if (!ValidateLength("VerificationImgCode", 5,6))
	    return false;

	jQuery.ajax({
	    url: "../ajax/Comment.AddEdit.ashx",
	    type: "post",
	    cache: "false",
	    data: {
	        "Item_Id": 0,
	        "Item_User": Item_User,
	        "Item_Tel": Item_Tel,
	        "Item_Content": Item_Content,
	        "Item_Time": Item_Time,
	        "Lang": Lang,
	        "VerificationImgCode": VerificationImgCode
	    },
	    dataType: "text",
	    beforeSend: function () { EffectBefore(); },
	    success: function (msg) {
	        $(".laoding").hide();

	        if (msg == "1") { window.location.href = "Complete.aspx?lang=" + Lang; }
	        else if (msg == "-2") {
	            ImgCodeReplace();
	            $("#Error").html(Lang_Error3);
	            $("#Error").show(500);
	        }
	        else {
	            $("#Error").html(msg);
	            $("#Error").show(500);
	            ImgCodeReplace();
	        }
	    },
	    error: function (XMLHttpRequest, textStatus, errorThrown) { alert("错误代码：" + XMLHttpRequest.status + " , 错误类型 ： " + XMLHttpRequest.readyState + " , 错误文本：" + textStatus) },
	    complete: function () { }
	});
}





function  EffectBefore()
{
    $(".laoding span").html(Lang_Wait);
    $(".laoding").show();
    $(".error").hide();
}



